package com.qk.command.impl;

import com.qk.Dao.PlayerDao;
import com.qk.command.Command;
import com.qk.my.pojos.Player;
import com.qk.my.wangtobesuper.App;
import com.qk.util.MyConsole;

public class LoginCommand implements Command {

	public void execute() {
		String username;
		String password;
		Player player;
		while (true) {
			username = MyConsole.askUserInput("用户账号");
			password = MyConsole.askUserInput("用户密码");
			player = PlayerDao.toLogin(username, password);
			if (player == null) {
				MyConsole.println("用户不存在或密码错误！");
				continue;

			}
			MyConsole.println("===========欢迎" + player.getName() + "回来");
			App.player = player;
			break;
		}
	}

}
